<template>
	<view>
		<view class="box">
			<view class="sub view" @click="sub">-</view>
			<input class="val" type="number" v-model="count">
			<view class="add view" @click="add">+</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"mynumber",
		props:{
			value:{
				type:[Number,String],
				default:1
			}
		},
		data() {
			return {
				count:1
			};
		},
		methods:{
			sub(count){
				if(this.count <= 1){
					this.count = 1
				}else{
					this.count -= 1
				}
			},
			add(count){
				this.count++
			}
		}
	}
</script>

<style lang="scss">
	.box{
		width: 200upx;
		height: 60upx;
		display: flex;
		align-items: center;
		justify-content: center;
		.view:avtive{
			background-color: #eee;
		}
		.view{
			width: 60upx;
			height: 60upx;
			line-height: 1;
			font-size: 50upx;
			text-align: center;
		}
		.add{
			color: #000;
		}
		.val{
			width: 60upx;
			height: 60upx;
			background: rgb(244,244,244);
			text-align: center;
		}
		.sub{
			color: rgb(234, 231, 231);
		}
	}
</style>
